<HEAD>
  <SCRIPT SRC="../ganja.js"></SCRIPT>
</HEAD>
<BODY><SCRIPT>
// Create a Clifford Algebra with 2,0,1 metric.
Algebra(2,0,1,()=>{

  // The Euler line connects several important points in any non equilateral triangle.

  // Not many identities needed..
  var point = (x,y)=>!(1e0 + x*1e1 + y*1e2);
  
  // Three points.
  var A = point(-1.5, -0.5), B = point(0.5, 1.5), C = point(1, -0.5),
  
  // The edges
      a = ()=>B & C, 
      b = ()=>C & A, 
      c = ()=>A & B,

  // The orthocenter
     oa = ()=>a | A, 
     ob = ()=>b | B, 
     oc = ()=>c | C, 
     ortho = ()=>oa ^ ob,
  
  // The circumcenter
      ca = ()=>c | (A + B), 
      cb = ()=>a | (B + C), 
      cc = ()=>b | (C + A), 
      circum = ()=>ca ^ cb,
      
  // The centroid      
      centroid = ()=>A + B + C,
  
  // The Euler line      
      line = ()=>ortho & circum;
   
  document.body.appendChild(this.graph([
      "Euler's Line","Drag the points",
      0xD0FFE1,[A,B,C],                        // triangle
      0x00AA88,[A,B],[B,C],[A,C],              // triangle edges
      0x882288,oa,ob,oc,ortho,"o",             // orthocenter
      0x224488,ca,cb,cc,circum,"c",            // circumcenter
      0x448844,centroid,line,"Euler Line",     // centroid and euler line
      0x224488,A,"A",B,"B",C,"C"               // triangle vertices
      ],{grid:true, lineWidth:2}));
});
</SCRIPT></BODY>